from django.urls import path

from apps.meiduo_admin.views import statistics, users, specs
# 导入token认证模块
from rest_framework_jwt.views import obtain_jwt_token
from rest_framework import routers

# 创建路由对象
router = routers.SimpleRouter()
router2 = routers.SimpleRouter()
# 生成路由
router.register(r'goods/specs', specs.SpecsView, basename='specs')
# sku表管理
router2.register(r'skus', specs.SkuViewSet, basename='skus')

urlpatterns = [
    # 管理员用户登录
    path('authorizations/', obtain_jwt_token),
    # 统计日增用户
    path('statistical/day_increment/', statistics.UserTodayAddView.as_view()),
    # 统计用户总数
    path('statistical/total_count/', statistics.UserCountView.as_view()),
    # 统计日活用户数
    path('statistical/day_active/', statistics.UserLiveView.as_view()),
    # 统计下单用户
    path('statistical/day_orders/', statistics.UserOrderView.as_view()),
    # 统计商品月访问量
    path('statistical/goods_day_views/', statistics.GoodsCountView.as_view()),
    # 统计用户月增量
    path('statistical/month_increment/', statistics.UserMonetCountView.as_view()),
    # 查询所有用户
    path('users/', users.GetCleckUserAll.as_view()),
    # 自定义方法获取简单spu
    path('goods/simple/', specs.SpecsView.as_view({'get': 'GetEasySpu'})),
    # 获得三级分类数据
    path('skus/categories/', specs.SkuViewSet.as_view({'get': 'categories'}))

]
# 添加商品路由
urlpatterns += router.urls
urlpatterns += router2.urls